package homework_1;

import java.util.ArrayList;

public class Test {
	static boolean addPer(Person person) { //if you need to write the metod in Person class,add another parameter ArrayList PerArrlist 
		for(Person p:PerArrlist) {
			if(p.equals(person)) {
				return false;
			}
		}
		PerArrlist.add(person);
		return true;
	 }
	static ArrayList<Person> PerArrlist= new ArrayList<>();
	public static void main(String[] args) {
		addPer(new Person("mike", 21));
		addPer(new Person("jack",22));
		addPer(new Person("mike", 21));
		for(Person p:PerArrlist) {
			System.out.println(p.name+" "+p.age);
		}
		
		
		
	}
	
}
